﻿/*
数字分组 
Time Limit:1000MS  Memory Limit:32768K

  
Description:
将1,2...9共9个数分成三组,分别组成三个三位数,且使这三个三位数构成1:2:3的比例
试求出所有满足条件的三个三位数. 例如:三个三位数192,384,576满足以上条件 

Input:
无 
Output:
按从小到大的顺序，输出满足条件的数，每行三个，数之间有一个空格。 192 384 576 
 */
/*
#include<iostream>
using namespace std;
int main()
{
	cout<<"192 384 576"<<endl
		<<"219 438 657"<<endl
		<<"273 546 819"<<endl
		<<"327 654 981"<<endl;
	return EXIT_SUCCESS;
}
*/
#define JUDGE(num)		\
	hundreds=num/100;	\
	if(exists[hundreds])\
		continue;		\
	exists[hundreds]=true;\
	tens=num/10%10;		\
	if(exists[tens])	\
		continue;		\
	exists[tens]=true;	\
	units=num%10;		\
	if(exists[units])	\
		continue;		\
		exists[units]=true;	

#include <iostream>
#include <cstdlib>
using namespace std;


int main()
{
	for (unsigned num = 192; num < 330; ++num)
	{
		bool exists[10] =
		{
			false
		};
		unsigned hundreds, tens, units;

		JUDGE(num);

		unsigned num2 = num + num;
		JUDGE(num2);	

		unsigned num3 = num2 + num;
		JUDGE(num3);
		for (unsigned i = 1; i < 10; ++i)
			if (!exists[i])
				break;	

		if (10 == i)
			printf("%u %u %u\n", num, num2, num3);
	}
	return EXIT_SUCCESS;
}